Methods that implement the CC2530ZNP Simple Application Programming Interface (Simple API). More...
#include "simple_api.h"#include "application_configuration.h"#include "znp_interface.h"#include "../HAL/hal.h"#include <string.h>#include "znp_interface_spi.h"Defines | |
| #define | ZB_APP_REGISTER_REQUEST_PAYLOAD_LEN 9 |
| #define | ZB_START_CONFIRM_TIMEOUT 5 |
| #define | ZB_APP_START_REQUEST_PAYLOAD_LEN 0 |
| #define | ZB_PERMIT_JOINING_REQUEST_PAYLOAD_LEN 3 |
| #define | ZB_SEND_DATA_CONFIRM_TIMEOUT 5 |
| #define | ZB_SEND_DATA_REQUEST_PAYLOAD_LEN 8 |
Functions | |
| void | sapiRegisterApplication (struct applicationConfiguration ac) |
| void | sapiRegisterGenericApplication () |
| void | sapiStartApplication () |
| void | setJoiningPermissions (unsigned int destination, unsigned char timeout) |
| void | sendData (unsigned int destinationShortAddress, unsigned int clusterId, unsigned char *data, unsigned char dataLength) |
Variables | |
| unsigned char | znpBuf [100] |
| unsigned char | sequenceNumber = 0 |
| signed int | znpResult |
Methods that implement the CC2530ZNP Simple Application Programming Interface (Simple API).
This Simple API is an easy-to-use interface to configure, send, and receive Zigbee data. This file acts as an interface between the user's application and the ZNP physical interface, either SPI or UART. Refer to Interface Specification for more information.
YOU ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
| void sapiRegisterApplication | ( | struct applicationConfiguration | ac | ) |
Configures the ZNP for our application. Sets which endpoint, profileId, etc. we're using as well as binding information.
| the | applicationConfiguration to register. |
| void sapiRegisterGenericApplication | ( | ) |
Configures the ZNP for a "generic" application: one endpoint, no binding or fancy stuff. Sets which endpoint, profileId, etc. we're using as well as binding information
| void sapiStartApplication | ( | ) |
Starts the Zigbee stack in the ZNP using the settings from a previous sapiRegisterApplication(). After this start request process completes, the device is ready to send, receive, and route network traffic.
| void sendData | ( | unsigned int | destinationShortAddress, | |
| unsigned int | clusterId, | |||
| unsigned char * | data, | |||
| unsigned char | dataLength | |||
| ) |
Sends a message to another device over the Zigbee network.
handle is an optional user-definable reference number to match SEND_DATA_CONFIRM messages with the SEND_DATA_REQUEST message. This can be used to determine which SEND_DATA_REQUEST generated an error. radius is the maximum number of hops that this packet can travel through before it will be dropped. Should be set to the maximum number of hops expected in the network. | destinationShortAddress | the short address of the destination, or ALL_DEVICES or ALL_ROUTERS_AND_COORDINATORS to broadcast the message. | |
| clusterId | which cluster this message is for. User definable. Zigbee supports up to 2^16 clusters. A cluster is typically a particular command, e.g. "turn on lights" or "get temperature". If using a predefined Zigbee Alliance Application Profile then this cluster will follow the Zigbee Cluster Library. | |
| data | is the data to send. | |
| dataLength | is how many bytes of data to send. Must be less than MAXIMUM_PAYLOAD_LENGTH. |
destinationShortAddress and that device has successfully started its application using sapiStartApplication(). | void setJoiningPermissions | ( | unsigned int | destination, | |
| unsigned char | timeout | |||
| ) |
Sets the Joining Permissions for this device or other devices. By default, after a setStartupOptions(CLEAR_CONFIG), joining is set to allow all devices, indefinitely.
| destination | which short address to set joining permissions for, or ALL_ROUTERS_AND_COORDINATORS to set joining permissions for all. | |
| timeout | how long in seconds to allow permissions, or if set to NO_TIMEOUT then joining will be on indefinitely. |
| unsigned char sequenceNumber = 0 |
Incremented for each SEND_DATA_REQUEST, wraps around to 0.
| unsigned char znpBuf[100] |
This buffer will hold the transmitted messages and received SRSP Payload after sendMessage() was called.
1.6.3